using System;

using Microsoft.Xna.Framework;

namespace AeonOfStrifeDatatypes.Units.Combat
{
	public abstract class Debuff {

		public float Duration { get; protected internal set; }

		public float Value { get; protected internal set; }

		public bool Update(GameTime p_gameTime) {
			if(Math.Ceiling(Duration) != Math.Ceiling(Duration + (float)p_gameTime.TotalGameTime.TotalSeconds)) {
				OnTick();
			}

			Duration -= (float)p_gameTime.TotalGameTime.TotalSeconds;
			return Duration <= 0f;
		}

		public virtual void OnTick() { }
		
		public virtual void OnReApply(Debuff p_debuff) {}

		public abstract void OnApply();

		public abstract void OnRemove();
	}
}